﻿package view.components.footer 
{
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	import flash.display.StageDisplayState;
	
	import gs.TweenLite;
	import gs.easing.Circ;
	
	/**
	 * ...
	 * @author Lobanov
	 */
	public class FullScreenBut extends MovieClip
	{
		
		public var linkArea:MovieClip;
		public var icoMask:MovieClip;
		
		public function FullScreenBut() 
		{
			linkArea.alpha = 0;
			linkArea.buttonMode = true;
			
			linkArea.addEventListener(MouseEvent.CLICK, clickHandle);
			linkArea.addEventListener(MouseEvent.ROLL_OVER, overHandle);
			linkArea.addEventListener(MouseEvent.ROLL_OUT, outHandle);
			
			/**
			 * EVENTS
			 */
			function overHandle(e:MouseEvent):void {
				TweenLite.to(icoMask, 2, { x:-2, ease:Circ.easeOut } );
			}
			
			function outHandle(e:MouseEvent):void {
				TweenLite.to(icoMask, 2, { x:-81.8, ease:Circ.easeOut} );
			}
			
			function clickHandle(e:MouseEvent):void {
				goFullScreen();
			}
		}
		
		private function goFullScreen():void
		{
			if (stage.displayState == StageDisplayState.NORMAL) {
				stage.displayState = StageDisplayState.FULL_SCREEN;
				this.nextFrame();
			} else {
				stage.displayState = StageDisplayState.NORMAL;
				this.prevFrame();
			}
		}

		
	}

}